<div class="select-box">
    <form action="detail-list.php" class="layui-form" id="search" >

        <div class="layui-form-item">
            <label class="layui-form-label">关键词</label>
            <div class="layui-input-block">
                <input type="text" name="select_keywords" placeholder="搜索标题" autocomplete="off" class="layui-input" value="<? echo $_REQUEST['select_keywords']?>" >
            </div>
        </div>





<!---->
<!--        --><?//
//        $department_list=select_lines_all_items($table_Prefix."department","nid desc","","0");
//        $department=select_one_line_all_items($table_Prefix."department","nid = '".$_REQUEST['select_departmentid']."'");
//        ?>
<!---->
<!---->
<!--        <div class="layui-form-item">-->
<!--            <label class="layui-form-label">网点</label>-->
<!--            <div class="layui-input-block">-->
<!--                <select name="select_departmentid" lay-verify="required" >-->
<!---->
<!---->
<!--                    --><?//
//                    if(($_REQUEST['select_departmentid']!='全部')&&(($_REQUEST['select_departmentid']!='')))
//                    {echo "<option value='".$_REQUEST['select_departmentid']."'>".$department['name']."</option>";}
//                    ?>
<!---->
<!---->
<!--                    <option value="全部">全部</option>-->
<!---->
<!---->
<!---->
<!--                    --><?//for($i=0;$i<count($department_list);$i++){?>
<!--                        <option value="--><?// echo $department_list[$i]['nid'] ?><!--">--><?// echo $department_list[$i]['name'];?><!--</option>-->
<!--                        --><?// ;} ?>
<!--                </select>-->
<!--            </div>-->
<!--        </div>-->
        
        <?
            $case_list=select_lines_all_items($table_Prefix."case","FIELD(status, '询价中', '进行中', '完成','客户终止') ,startdate desc,nid desc","","0");
            //获取要用到的单位名字
            $unit_nid_list=transform_2darray_in_1darray_with_new_key($case_list,"nid","unit");
            $unit_nid_list_str=implode("','",$unit_nid_list);
            $unit_list=select_lines_all_items($table_Prefix."unit","","nid in ('".$unit_nid_list_str."')","");
            $unit_name_list=transform_2darray_in_1darray_with_new_key($unit_list,"nid","sname");
        ?>  

        <div class="layui-form-item">
            <label class="layui-form-label">项目</label>
            <div class="layui-input-block">
                <select name="select_case_id" lay-search="" value="<? echo $_REQUEST['select_case_id']?>">
                    <option value="">全部</option>
                    <? for($i=0;$i<count($case_list);$i++){ ?>
                        <option value="<? echo $case_list[$i]['nid'] ?>" <?php if($_REQUEST['select_case_id'] == $case_list[$i]['nid']){echo "selected";} ?> >【<?echo $unit_name_list[$case_list[$i]['unit']]?>】<? echo $case_list[$i]['name'] ?>-<?echo $case_list[$i]['status']?></option>
                    <? } ?>
                </select>
            </div>
        </div>

        <?
        $employee_list=select_lines_all_items($table_Prefix."employee","nid asc","status ='在职'","0");
        //查询任务板块管理员
        $setting = select_one_line_all_items($table_Prefix."task_setting","nid = '1'");

        $manager_user_id = explode(',',$setting['manager_user_id']);

        // 权限验证 管理员查看所有人的任务 普通用户只查看自己的任务
        if(in_array($_SESSION['nid'],$manager_user_id)){
            $auth = true;
        }else{
            $auth = false;
        }
        ?>

        <?php if ($auth): ?>

        <div class="layui-form-item">
            <label class="layui-form-label">执行人</label>
            <div class="layui-input-block">
                <select name="select_principal_id" lay-search="select_principal_id" value="<?php echo $_REQUEST['select_principal_id']?>">
                    <option value="">全部</option>
                    <? for($i=0;$i<count($employee_list);$i++){ ?>
                        <option value="<? echo $employee_list[$i]['nid'] ?>" <?php if($_REQUEST['select_principal_id'] == $employee_list[$i]['nid']){echo "selected";} ?> ><? echo $employee_list[$i]['name'] ?></option>
                    <? } ?>
                </select>
            </div>
        </div>

        <?php endif; ?>

        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                <select name="select_status" lay-search="">
                    <option value="未完成" selected>未完成</option>
                    <option value="未开始" <? if($_REQUEST['select_status']=="未开始"){echo "selected";} ?>>未开始</option>
                    <option value="进行中" <? if($_REQUEST['select_status']=="进行中"){echo "selected";} ?>>进行中</option>
                    <option value="待审核" <? if($_REQUEST['select_status']=="待审核"){echo "selected";} ?>>待审核</option>
                    <option value="已完成" <? if($_REQUEST['select_status']=="已完成"){echo "selected";} ?>>已完成</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">截止时间</label>

            <div class="layui-input-block">
                <input type="text" name="select_startday" placeholder="请输入开始时间" autocomplete="off" class="layui-input"  onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" style="float: left; width: 112px" value="<?if($_REQUEST['select_startday']){echo $_REQUEST['select_startday'] ;} ?>" >

                <span style="float: left;margin: 0 4px; line-height: 30px;">-</span>


                <input type="text" name="select_endday" placeholder="请输入结束时间" autocomplete="off" class="layui-input" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"  style="float: left; width:112px" value="<?if($_REQUEST['select_endday']){echo $_REQUEST['select_endday'] ;} ?>"  >


                <input type="hidden" name="sys_part"  value="task" >


            </div>


        </div>

        <button class="layui-btn  layui-btn-sm" ><i class="layui-icon">&#xe615;</i> 查找</button>

        <a class="layui-btn white  layui-btn-sm" href="detail-list.php?sys_part=task" ><i class="layui-icon">&#x1006;</i> 重置</a>


        <br class="clearfloat"/>
    </form>


</div>




<script>



    layui.use('form', function(){
        var form = layui.form;


        form.on('select()', function(data){
            //提交表单
            document.getElementById("search").submit();

        });



    });


</script>





